package datastructure.array

/**
 * [Sparse Arrays](https://www.hackerrank.com/challenges/sparse-arrays)
 */
// Complete the matchingStrings function below.
fun matchingStrings(strings: Array<String>, queries: Array<String>): Array<Int> {
    val ans = Array<Int>(queries.size) { 0 }

    queries.forEachIndexed { index, s ->
        ans[index] = strings.count { it == s }
    }

    return ans
}